package com.sl.happying.reading.dao;

import com.sl.happying.reading.bean.Novel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface NovelDao extends JpaRepository<Novel, Integer> {


    List<Novel> findByNovelName(String novelName );

    @Modifying
    @Transactional
    @Query("delete from Novel novel where novel.novelName = ?1")
    void delete(String novelName);
}
